const theme = {
     state: {
        isSunny: true,
        isMoon: false
    },
    getters: {
        isSunny: state => {
            return state.isSunny
        },
        isMoon: state => {
            return state.isMoon
        }
    },
    mutations: {
        getIconTheme(state) {
            switch (window.sessionStorage.getItem('theme')) {
                case null:
                    state.isSunny = true
                    state.isMoon = false
                    break;
                case 'sunny':
                    state.isSunny = true
                    state.isMoon = false
                    break;
                case 'moon':
                    state.isSunny = false
                    state.isMoon = true
                    break;
                default:
                    break
            }
        },
        changeIconTheme(state) {
            state.isSunny = !state.isSunny
            state.isMoon = !state.isMoon
            if (state.isSunny === true) {
                window.sessionStorage.setItem('theme', 'sunny')
            } else {
                window.sessionStorage.setItem('theme', 'moon')
            }
        }
    }
}




export default theme